<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:p="http://primefaces.prime.com.tr/ui">

    <ui:composition template="/template/DefaultTemplate.xhtml">

        <ui:define name="content">
            <h:form >
                <p:panel toggleable="true" id="inventoryView" header="Inventory Overview">
                    <h:panelGrid columns="2">
                        <h:outputLabel value="Total Usage= #{rawMaterialEntityController.totalRMUsage}"/>
                        <p:spacer width="60" height="10"/>
                        <h:outputLabel value="Total Capacity= #{rawMaterialEntityController.totalRMCapacity}"/>
                    </h:panelGrid>

                    <h:panelGrid cellpadding="5" width="400" border="3" columns="4">
                        <h:outputText value=""/>
                        <h:outputText value="Total"/>
                        <h:outputLabel value=""/>
                        <h:outputLabel value=""/>

                        <h:outputText value="Almonds"/>
                        <h:outputLabel style="table-layout: center" value="#{rawMaterialEntityController.totalAlmonds}"/>
                        <p:spinner id="almondSpinner" max="#{rawMaterialEntityController.totalAlmonds}" value="#{rawMaterialEntityController.amtToRemove}"/>
                        <p:commandButton value="Remove" process="@this, almondSpinner" update="inventoryView" action="#{rawMaterialEntityController.removeRMFromInventory}">
                            <f:setPropertyActionListener target="#{rawMaterialEntityController.currentRMString}" value="Almonds"/>
                        </p:commandButton>

                        <h:outputText value="Apples"/>
                        <h:outputLabel style="table-layout: center" value="#{rawMaterialEntityController.totalApples}"/>
                        <p:spinner id="appleSpinner" max="#{rawMaterialEntityController.totalApples}" value="#{rawMaterialEntityController.amtToRemove}"/>
                           <p:commandButton value="Remove" process="@this, appleSpinner" update="inventoryView" action="#{rawMaterialEntityController.removeRMFromInventory}">
                            <f:setPropertyActionListener target="#{rawMaterialEntityController.currentRMString}" value="Apples"/>
                        </p:commandButton>

                        <h:outputText value="Apricots"/>
                        <h:outputLabel style="table-layout: center" value="#{rawMaterialEntityController.totalApricots}"/>
                        <p:spinner id="apriSpinner" max="#{rawMaterialEntityController.totalApricots}" value="#{rawMaterialEntityController.amtToRemove}"/>
                        <p:commandButton value="Remove" process="@this, apriSpinner" update="inventoryView" action="#{rawMaterialEntityController.removeRMFromInventory}">
                            <f:setPropertyActionListener target="#{rawMaterialEntityController.currentRMString}" value="Apricots"/>
                        </p:commandButton>

                        <h:outputText value="Oats"/>
                        <h:outputLabel style="table-layout: center" value="#{rawMaterialEntityController.totalOats}"/>
                        <p:spinner id="oatSpinner" max="#{rawMaterialEntityController.totalOats}" value="#{rawMaterialEntityController.amtToRemove}"/>
                             <p:commandButton value="Remove" process="@this, oatSpinner" update="inventoryView" action="#{rawMaterialEntityController.removeRMFromInventory}">
                            <f:setPropertyActionListener target="#{rawMaterialEntityController.currentRMString}" value="Oats"/>
                        </p:commandButton>

                        <h:outputText value="Wheat Germ"/>
                        <h:outputLabel style="table-layout: center" value="#{rawMaterialEntityController.totalWheatGerm}"/>
                        <p:spinner id="wgSpinner" max="#{rawMaterialEntityController.totalWheatGerm}" value="#{rawMaterialEntityController.amtToRemove}"/>
                           <p:commandButton value="Remove" process="@this, wgSpinner" update="inventoryView" action="#{rawMaterialEntityController.removeRMFromInventory}">
                            <f:setPropertyActionListener target="#{rawMaterialEntityController.currentRMString}" value="Wheat Germ"/>
                        </p:commandButton>

                        <h:outputText value="Cinnamon"/>
                        <h:outputLabel style="table-layout: center" value="#{rawMaterialEntityController.totalCinnamon}"/>
                        <p:spinner id="cinnSpinner" max="#{rawMaterialEntityController.totalCinnamon}" value="#{rawMaterialEntityController.amtToRemove}"/>
                              <p:commandButton value="Remove" process="@this, cinnSpinner" update="inventoryView" action="#{rawMaterialEntityController.removeRMFromInventory}">
                            <f:setPropertyActionListener target="#{rawMaterialEntityController.currentRMString}" value="Cinnamon"/>
                        </p:commandButton>

                        <h:outputText value="Nutmeg"/>
                        <h:outputLabel style="table-layout: center" value="#{rawMaterialEntityController.totalNutmeg}"/>
                        <p:spinner id="nutmegSpinner" max="#{rawMaterialEntityController.totalNutmeg}" value="#{rawMaterialEntityController.amtToRemove}"/>
                             <p:commandButton value="Remove" process="@this, nutmegSpinner" update="inventoryView" action="#{rawMaterialEntityController.removeRMFromInventory}">
                            <f:setPropertyActionListener target="#{rawMaterialEntityController.currentRMString}" value="Nutmeg"/>
                        </p:commandButton>

                        <h:outputText value="Cloves"/>
                        <h:outputLabel style="table-layout: center" value="#{rawMaterialEntityController.totalCloves}"/>
                        <p:spinner id="clovesSpinner" max="#{rawMaterialEntityController.totalCloves}" value="#{rawMaterialEntityController.amtToRemove}"/>
                            <p:commandButton value="Remove" process="@this, clovesSpinner" update="inventoryView" action="#{rawMaterialEntityController.removeRMFromInventory}">
                            <f:setPropertyActionListener target="#{rawMaterialEntityController.currentRMString}" value="Cloves"/>
                        </p:commandButton>

                        <h:outputText value="Honey"/>
                        <h:outputLabel style="table-layout: center" value="#{rawMaterialEntityController.totalHoney}"/>
                        <p:spinner id="honeySpinner" max="#{rawMaterialEntityController.totalHoney}" value="#{rawMaterialEntityController.amtToRemove}"/>
                          <p:commandButton value="Remove" process="@this, honeySpinner" update="inventoryView" action="#{rawMaterialEntityController.removeRMFromInventory}">
                            <f:setPropertyActionListener target="#{rawMaterialEntityController.currentRMString}" value="Honey"/>
                        </p:commandButton>

                        <h:outputText value="Vit Mineral Powder"/>
                        <h:outputLabel style="table-layout: center" value="#{rawMaterialEntityController.totalVitMineralPowder}"/>
                        <p:spinner id="vmpSpinner" max="#{rawMaterialEntityController.totalVitMineralPowder}" value="#{rawMaterialEntityController.amtToRemove}"/>
                           <p:commandButton value="Remove" process="@this, vmpSpinner" update="inventoryView" action="#{rawMaterialEntityController.removeRMFromInventory}">
                            <f:setPropertyActionListener target="#{rawMaterialEntityController.currentRMString}" value="Vit Mineral Powder"/>
                        </p:commandButton>

                        <h:outputText value="Carob Chips"/>
                        <h:outputLabel style="table-layout: center" value="#{rawMaterialEntityController.totalCarobChips}"/>
                        <p:spinner id="ccSpinner" max="#{rawMaterialEntityController.totalCarobChips}" value="#{rawMaterialEntityController.amtToRemove}"/>
                            <p:commandButton value="Remove" process="@this, ccSpinner" update="inventoryView" action="#{rawMaterialEntityController.removeRMFromInventory}">
                            <f:setPropertyActionListener target="#{rawMaterialEntityController.currentRMString}" value="Carob Chips"/>
                        </p:commandButton>

                        <h:outputText value="Protein Powder"/>
                        <h:outputLabel style="table-layout: center" value="#{rawMaterialEntityController.totalProteinPowder}"/>
                        <p:spinner id="ppSpinner" max="#{rawMaterialEntityController.totalProteinPowder}" value="#{rawMaterialEntityController.amtToRemove}"/>
                             <p:commandButton value="Remove" process="@this, ppSpinner" update="inventoryView" action="#{rawMaterialEntityController.removeRMFromInventory}">
                            <f:setPropertyActionListener target="#{rawMaterialEntityController.currentRMString}" value="Protein Powder"/>
                        </p:commandButton>

                        <h:outputText value="Cocoa Powder"/>
                        <h:outputLabel style="table-layout: center" value="#{rawMaterialEntityController.totalCocoaPowder}"/>
                        <p:spinner id="cocoaSpinner" max="#{rawMaterialEntityController.totalCocoaPowder}" value="#{rawMaterialEntityController.amtToRemove}"/>
                            <p:commandButton value="Remove" process="@this, cocoaSpinner" update="inventoryView" action="#{rawMaterialEntityController.removeRMFromInventory}">
                            <f:setPropertyActionListener target="#{rawMaterialEntityController.currentRMString}" value="Cocoa Powder"/>
                        </p:commandButton>

                        <h:outputText value="Hazelnuts"/>
                        <h:outputLabel style="table-layout: center" value="#{rawMaterialEntityController.totalHazelnuts}"/>
                        <p:spinner id="hazelSpinner" max="#{rawMaterialEntityController.totalHazelnuts}" value="#{rawMaterialEntityController.amtToRemove}"/>
                            <p:commandButton value="Remove" process="@this, hazelSpinner" update="inventoryView" action="#{rawMaterialEntityController.removeRMFromInventory}">
                            <f:setPropertyActionListener target="#{rawMaterialEntityController.currentRMString}" value="Hazelnuts"/>
                        </p:commandButton>

                        <h:outputText value="Cashew Nuts"/>
                        <h:outputLabel style="table-layout: center" value="#{rawMaterialEntityController.totalCashewNuts}"/>
                        <p:spinner id="cashewSpinner" max="#{rawMaterialEntityController.totalCashewNuts}" value="#{rawMaterialEntityController.amtToRemove}"/>
                          <p:commandButton value="Remove" process="@this, cashewSpinner" update="inventoryView" action="#{rawMaterialEntityController.removeRMFromInventory}">
                            <f:setPropertyActionListener target="#{rawMaterialEntityController.currentRMString}" value="Cashew Nuts"/>
                        </p:commandButton>

                        <h:outputText value="Walnuts"/>
                        <h:outputLabel style="table-layout: center" value="#{rawMaterialEntityController.totalWalnuts}"/>
                        <p:spinner id="walnutsSpinner" max="#{rawMaterialEntityController.totalWalnuts}" value="#{rawMaterialEntityController.amtToRemove}"/>
                           <p:commandButton value="Remove" process="@this, walnutsSpinner" update="inventoryView" action="#{rawMaterialEntityController.removeRMFromInventory}">
                            <f:setPropertyActionListener target="#{rawMaterialEntityController.currentRMString}" value="Walnuts"/>
                        </p:commandButton>

                        <h:outputText value="Macadamias"/>
                        <h:outputLabel style="table-layout: center" value="#{rawMaterialEntityController.totalMacadamias}"/>
                        <p:spinner id="macSpinner" max="#{rawMaterialEntityController.totalMacadamias}" value="#{rawMaterialEntityController.amtToRemove}"/>
                            <p:commandButton value="Remove" process="@this, macdSpinner" update="inventoryView" action="#{rawMaterialEntityController.removeRMFromInventory}">
                            <f:setPropertyActionListener target="#{rawMaterialEntityController.currentRMString}" value="Macadamias"/>
                        </p:commandButton>

                        <h:outputText value="Redcurrants"/>
                        <h:outputLabel style="table-layout: center" value="#{rawMaterialEntityController.totalRedcurrants}"/>
                        <p:spinner id="redcurrantsSpinner" max="#{rawMaterialEntityController.totalRedcurrants}" value="#{rawMaterialEntityController.amtToRemove}"/>
                            <p:commandButton value="Remove" process="@this, redcurrantsSpinner" update="inventoryView" action="#{rawMaterialEntityController.removeRMFromInventory}">
                            <f:setPropertyActionListener target="#{rawMaterialEntityController.currentRMString}" value="Redcurrants"/>
                        </p:commandButton>

                        <h:outputText value="Raisins"/>
                        <h:outputLabel style="table-layout: center" value="#{rawMaterialEntityController.totalRaisins}"/>
                        <p:spinner id="raisinsSpinner" max="#{rawMaterialEntityController.totalRaisins}" value="#{rawMaterialEntityController.amtToRemove}"/>
                           <p:commandButton value="Remove" process="@this, raisinsSpinner" update="inventoryView" action="#{rawMaterialEntityController.removeRMFromInventory}">
                            <f:setPropertyActionListener target="#{rawMaterialEntityController.currentRMString}" value="Raisins"/>
                        </p:commandButton>

                        <h:outputText value="Dates"/>
                        <h:outputLabel style="table-layout: center" value="#{rawMaterialEntityController.totalDates}"/>
                        <p:spinner id="datesSpinner" max="#{rawMaterialEntityController.totalDates}" value="#{rawMaterialEntityController.amtToRemove}"/>
                      <p:commandButton value="Remove" process="@this, datesSpinner" update="inventoryView" action="#{rawMaterialEntityController.removeRMFromInventory}">
                            <f:setPropertyActionListener target="#{rawMaterialEntityController.currentRMString}" value="Dates"/>
                        </p:commandButton>

                        <h:outputText value="Kiwis"/>
                        <h:outputLabel style="table-layout: center" value="#{rawMaterialEntityController.totalKiwis}"/>
                        <p:spinner id="kiwiSpinner" max="#{rawMaterialEntityController.totalKiwis}" value="#{rawMaterialEntityController.amtToRemove}"/>
                      <p:commandButton value="Remove" process="@this, kiwiSpinner" update="inventoryView" action="#{rawMaterialEntityController.removeRMFromInventory}">
                            <f:setPropertyActionListener target="#{rawMaterialEntityController.currentRMString}" value="Kiwis"/>
                        </p:commandButton>

                        <h:outputText value="Peaches"/>
                        <h:outputLabel style="table-layout: center" value="#{rawMaterialEntityController.totalPeaches}"/>
                        <p:spinner id="peachSpinner" max="#{rawMaterialEntityController.totalPeaches}" value="#{rawMaterialEntityController.amtToRemove}"/>
                         <p:commandButton value="Remove" process="@this, peachSpinner" update="inventoryView" action="#{rawMaterialEntityController.removeRMFromInventory}">
                            <f:setPropertyActionListener target="#{rawMaterialEntityController.currentRMString}" value="Peaches"/>
                        </p:commandButton>
                    </h:panelGrid>

                </p:panel>
                <br/>
            </h:form>


        </ui:define>
    </ui:composition>

</html>
